package com.ruoyi.jeeplus.modules.screen.frontdesk.screen_terminal_number.controller;

import com.ruoyi.jeeplus.modules.screen.frontdesk.screen_PV.domain.Frontdesk_screen_PV;
import com.ruoyi.jeeplus.modules.screen.frontdesk.screen_PV.mapper.FrontdeskScreenPVMapper;
import com.ruoyi.jeeplus.modules.screen.frontdesk.screen_terminal_number.domain.Frontdesk_screen_terminal_number;
import com.ruoyi.jeeplus.modules.screen.frontdesk.screen_terminal_number.mapper.Frontdesk_screen_terminal_numberMapper;
import com.ruoyi.jeeplus.modules.screen.frontdesk.screen_terminal_number.service.impl.Frontdesk_screen_terminal_numberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author 刘奥旸
 * @version 1.0
 */
@RestController
public class screen_terminal_numberController {
    @Autowired
    Frontdesk_screen_terminal_numberService frontdeskScreenTerminalNumberService;
    @Autowired
    Frontdesk_screen_terminal_numberMapper frontdeskScreenTerminalNumberMapper;
    @Autowired
    FrontdeskScreenPVMapper frontdeskScreenPVMapper;
//    @GetMapping(value = "/lay/123")
//    private List<Frontdesk_screen_terminal_number>  lay(){
//        List<Frontdesk_screen_terminal_number> rechargeStationDetails = frontdeskScreenTerminalNumberMapper.getRechargeStationDetails();
//        return rechargeStationDetails;
//    }
    //备用
    @GetMapping(value = "/lay/terminal_four")
    private Map<String, Object> lay1(@RequestParam String id){
        // 正则表达式判断 id 是否是数字
        if (id.matches("^[0-9]+$")) {
            int region_id = Integer.parseInt(id);
            // 如果 id 是数字，执行数字相关的逻辑
//            Map<String, Object> stringObjectMap = frontdeskScreenTerminalNumberService.getlevel_using(region_id);
            Map<String, Object> stringObjectMap = frontdeskScreenTerminalNumberService.four_getlevel_using(region_id);
            return stringObjectMap;
        }else {
            //这是省的逻辑，文字查出来
            int region_id = frontdeskScreenPVMapper.getIdByName(id);
            //String region = region_id + "";
            Map<String, Object> stringObjectMap = frontdeskScreenTerminalNumberService.four_getlevel_using(region_id);
            return stringObjectMap;
        }
    }


    @GetMapping(value = "/lay/terminal")
    private Map<String, Object> lay15(@RequestParam String id){
        // 正则表达式判断 id 是否是数字
        if (id.matches("^[0-9]+$")) {
            int region_id = Integer.parseInt(id);
            // 如果 id 是数字，执行数字相关的逻辑
            Map<String, Object> stringObjectMap = frontdeskScreenTerminalNumberService.getlevel_using(region_id);
            return stringObjectMap;
        }else {
            //这是省的逻辑，文字查出来
            int region_id = frontdeskScreenPVMapper.getIdByName(id);
            //String region = region_id + "";
            Map<String, Object> stringObjectMap = frontdeskScreenTerminalNumberService.getlevel_using(region_id);
            return stringObjectMap;
        }
//
//        Map<String, Object> stringObjectMap = frontdeskScreenTerminalNumberService.getlevel_using(id);
//        return stringObjectMap;
    }
//    @GetMapping(value = "/lay/terminal/four")
//    private Map<String, Object> lay_four(@RequestParam String id){
//        // 正则表达式判断 id 是否是数字
//        if (id.matches("^[0-9]+$")) {
//            int region_id = Integer.parseInt(id);
//            // 如果 id 是数字，执行数字相关的逻辑
//            Map<String, Object> stringObjectMap = frontdeskScreenTerminalNumberService.getlevel_using(region_id);
//            return stringObjectMap;
//        }else {
//            //这是省的逻辑，文字查出来
//            int region_id = frontdeskScreenPVMapper.getIdByName(id);
//            //String region = region_id + "";
//            Map<String, Object> stringObjectMap = frontdeskScreenTerminalNumberService.getlevel_using(region_id);
//            return stringObjectMap;
//        }
//
//        Map<String, Object> stringObjectMap = frontdeskScreenTerminalNumberService.getlevel_using(id);
//        return stringObjectMap;
//    }
}
